//
//  TabBar.m
//  YiLiao
//
//  Created by mac on 16/7/1.
//  Copyright © 2016年 Noah. All rights reserved.
//

#import "TabBar.h"

@interface TabBar ()

@end

@implementation TabBar

- (void)viewDidLoad {
    [super viewDidLoad];

    
    NSArray *barNameArray=@[@"主页",@"新闻",@"文件",@"个人"];
    NSArray *barImageArray=@[@"main@2x",@"news@2x",@"person@2x",@"file@2x"];
    NSArray *barImageHLArray=@[@"main",@"news",@"person",@"file"];
    NSArray *vcArray=@[@"MyFriends",@"News",@"DownLoad",@"MyPerson"];
    NSMutableArray *navArray=[NSMutableArray new];
    for(int i=0;i<vcArray.count;i++){
        NSString *vcName=vcArray[i];
        Class vcClass=NSClassFromString(vcName);
        UIViewController *vc=[[vcClass alloc]init];
        vc.tabBarItem.title=barNameArray[i];
        vc.tabBarItem.image=[[UIImage imageNamed:barImageArray[i]] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
        vc.tabBarItem.selectedImage=[[UIImage imageNamed:barImageHLArray[i]] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
        UINavigationController *nav=[[UINavigationController alloc]initWithRootViewController:vc];
        [navArray addObject:nav];
    }
    self.viewControllers=navArray;
    self.selectedIndex=0;

}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
